/**
 * file
 */
package com.tdkj.model.newShop;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.tdkj.model.base.BaseEntity;

/**
 * 
 * FileName: ShopCommodityType.java
 * 
 * @Description: TODO商品分类
 * 
 *               All rights Reserved, Designed By ZTE-ITS
 * 
 *               Copyright: Copyright(C) 2010-2011
 * 
 *               Company 天成科技有限公司
 * 
 * @author: 李兴建
 * 
 * @version V1.0
 * 
 *          Createdate: 2012-5-29 下午10:12:14
 * 
 * 
 * 
 *          Modification History:
 * 
 *          Date Author Version Discription
 * 
 * 
 * 
 * 
 *          
 *          ----------------------------------------------------------------------
 *          -------------
 * 
 *          2012-5-29 李兴建 1.0 1.0
 * 
 *          Why & What is modified: <修改原因描述>
 */
@Entity
@Table(name = "Shop_Commodity_type")
public class ShopCommodityType extends BaseEntity {

	private static final long serialVersionUID = 3476396746354194441L;
	// 父ID
	private ShopCommodityType parent;
	// 孩子
	private Set<ShopCommodityType> chils = new HashSet<ShopCommodityType>();
	// 分类名称
	private String name;
	// 描述
	private String description;
	// 层
	private Integer level;

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	// 商品
	private Set<ShopCommodity> shopCommoditys = new HashSet<ShopCommodity>();

	@OneToMany(mappedBy = "parent", cascade = { CascadeType.REFRESH }, fetch = FetchType.LAZY)
	public Set<ShopCommodityType> getChils() {
		return chils;
	}

	public void setChils(Set<ShopCommodityType> chils) {
		this.chils = chils;
	}

	@ManyToOne(cascade = { CascadeType.REFRESH }, fetch = FetchType.LAZY)
	@JoinColumn(name = "parentId")
	public ShopCommodityType getParent() {
		return parent;
	}

	public void setParent(ShopCommodityType parent) {
		this.parent = parent;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@OneToMany(mappedBy = "commodityType", cascade = { CascadeType.REFRESH }, fetch = FetchType.LAZY)
	public Set<ShopCommodity> getShopCommoditys() {
		return shopCommoditys;
	}

	public void setShopCommoditys(Set<ShopCommodity> shopCommoditys) {
		this.shopCommoditys = shopCommoditys;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}
}
